<!doctype html>
<html>
<body>
    <div style="display:flex;align-items:center;">
        <img src="../../data/test_sunrise.jpg" id="sunrise_img" width="20%">
        <img src="../../data/arrow.svg" width="15%">
        <canvas id="target_img"></canvas>
    </div>

    <script src="../../../flycv.js" type="text/javascript"></script>
    <script type="text/javascript">
        fcv.then((fcv) => {
            // 读取图像，构造mat数据
            let srcRgba = fcv.imread("sunrise_img");

            // todo：circle当前只支持三通道数据
            let srcRgb = new fcv.Mat();
            fcv.cvtColor(srcRgba, srcRgb, fcv.ColorConvertType.CVT_PA_RGBA2PA_RGB);

            let center = new fcv.Point(srcRgb.width() / 2, srcRgb.height() / 2);
            let scalar = [255, 255, 0, 255];
            fcv.circle(srcRgb, center, 50, scalar, 1, fcv.LineType.LINE_8, 0);

            // 可视化
            fcv.imshow("target_img", srcRgb);

            // 内存回收
            srcRgba.delete();
            srcRgb.delete();
            center.delete();
        });
    </script>
</body>
</html>